import { Column, Entity, Index, PrimaryGeneratedColumn } from "typeorm";

@Index("idx_tag_type", ["tagType"], {})
@Index("idx_tag_id", ["tagId"], {})
@Index("idx_rel_id", ["relId"], {})
@Entity("rrz_tag_rel", { schema: "rrzcms" })
export class RrzTagRel {
  @PrimaryGeneratedColumn({
    type: "bigint",
    name: "id",
    comment: "表id",
    unsigned: true,
  })
  id: string;

  @Column("int", { name: "tag_id", comment: "标签ID", unsigned: true })
  tagId: number;

  @Column("bigint", {
    name: "rel_id",
    comment: "对象ID",
    unsigned: true,
    default: () => "'0'",
  })
  relId: string;

  @Column("tinyint", {
    name: "tag_type",
    comment: "标签类型（1：文章，2：产品）",
    unsigned: true,
    default: () => "'1'",
  })
  tagType: number;

  @Column("int", {
    name: "type_id",
    comment: "对象分类ID",
    unsigned: true,
    default: () => "'0'",
  })
  typeId: number;

  @Column("varchar", { name: "tag_title", comment: "标签", length: 50 })
  tagTitle: string;

  @Column("int", {
    name: "last_modify",
    comment: "更新时间",
    unsigned: true,
    default: () => "'0'",
  })
  lastModify: number;
}
